import React from 'react'
import { useLocalStorage } from '@rehooks/local-storage';

const Local = () => {
    const [user, setUser,delUser] = useLocalStorage('user',{});
    const [num, setNum, delNum] = useLocalStorage('num',100);
    return (
        <div>
            <div>
                <h2>{user.name}</h2>
                <button onClick={()=>setUser({name:'zhangsan'})}>设置user</button>
                <button onClick={delUser}>删除用户</button>
            </div>
            <div>
                <h2>{num}</h2>
                <button>设置Num</button>
            </div>
        </div>
    )
}

export default Local